package de.szut.ita13sommerfeld.apacheanalyser.libaries;

import java.util.ArrayList;
import java.util.Set;

public class StatusLibary extends Libary<Integer, ArrayList<Integer>>{

	private static final long serialVersionUID = 1L;

	/**
	 * prints out all values of the resource libary
	 */
	public void showValues() {
		Set<Entry<Integer, ArrayList<Integer>>> entrySet = entrySet();
		for(Entry<Integer, ArrayList<Integer>> entry : entrySet) {
			System.out.println((entry.getKey().intValue() * 100) + "er" + " " + entry.getValue().size());
		}
	}
	/**
	 * 
	 * @param statusType is the currentStatus divided by 100
	 * @param currentStatus the status that gets add to the statuslibary
	 * @param statusLibary the libary that gets the new value
	 */
	
	public static void addStatusToLibary(int statusType, int currentStatus, StatusLibary statusLibary) {
		if(!statusLibary.containsKey(statusType)) {
			ArrayList<Integer> status = new ArrayList<Integer>();
			status.add(currentStatus);
			statusLibary.put(statusType, status);
		} else {
			ArrayList<Integer> status = statusLibary.get(statusType);
			status.add(currentStatus);
		}
	}

}
